package com.yongbao.model.util;

import com.yongbao.model.dtomapper.PermissionDtoMapper;
import com.yongbao.model.domain.PermissionDO;
import com.yongbao.model.vo.PermissionVO;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhanghong
 */
public class PermissionConvert {

    public static List<PermissionVO> buildPermissionVoList(List<PermissionDO> permissionDOList) {
        if (CollectionUtils.isEmpty(permissionDOList)) {
            return Lists.newArrayList();
        }
        List<PermissionVO> permissionVOList = new ArrayList<>();
        for (PermissionDO permissionDO : permissionDOList) {
            permissionVOList.add(PermissionDtoMapper.INSTANCE.do2VO(permissionDO));
        }

        return permissionVOList;
    }
}
